﻿using System;
using System.Runtime.InteropServices;

namespace testIP
{
    public enum GWL
    {

        ExStyle = -20,
        GWL_HWNDPARENT = -8

    }
    public enum WS_EX
    {
        Transparent = 0x20,
        Layered = 0x80000
    }
    public enum LWA
    {
        ColorKey = 0x1,
        Alpha = 0x2
    }

    public static class User32API
    {
        public const int HWND_BOTTOM = 1; //{在后面}
        public const int GW_HWNDNEXT = 2;

        public const int GWL_HWNDPARENT = -8;
        public const int SE_SHUTDOWN_PRIVILEGE = 0x13;

        [DllImport("User32.dll", EntryPoint = "FindWindow")]
        public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
        [DllImport("User32.dll", EntryPoint = "FindWindowEx")]
        public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpClassName, string lpWindowName);

        [DllImport("user32.dll", EntryPoint = "GetWindowLong")]
        public static extern int GetWindowLong(IntPtr hWnd, GWL nIndex);

        [DllImport("user32.dll", EntryPoint = "SetWindowLong")]
        public static extern int SetWindowLong(IntPtr hWnd, GWL nIndex, int dwNewLong);

        [DllImport("user32.dll", EntryPoint = "SetLayeredWindowAttributes")]
        public static extern bool SetLayeredWindowAttributes(IntPtr hWnd, int crKey, byte alpha, LWA dwFlags);


        [DllImport("user32.dll")]
        public static extern IntPtr GetWindow(IntPtr hwnd, int wCmd);

        [DllImport("user32.dll")]
        public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);

        [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern bool SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int y, int cx, int cy, int flags);

    }
}